<template>
	<view>
		<view class="page-appoint">
			<view class="appoint-item" v-for="item in list" :key="item.id" >
					<view>车队名：{{item.cdname}}</view>
					<view>车队人数：{{item.num}}</view>
					<view>
						<view class="fv" @click="delcd(item.id)">删除车队</view>
					</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[]
			}
		},
		created() {
			this.init()
		},
			
		methods: {
			async init(){
					let data = {
						uid:uni.getStorageSync('uid')
					}
				    let res = await this.$api.getmycarlist(data)	
					console.log(res.data.data)
					this.list = res.data.data
			},
			async delcd(e){
				let data = {
					id:e
				}
				let res = await this.$api.delcdlist(data)	
				if(res.data.code==0){
					uni.showToast({
					  title:  res.data.msg,	
					  icon:'none',
					  duration: 2000
					});
					this.init();
				}else{
					uni.showToast({
					  title: res.data.msg,	
					  icon:'none',
					  duration: 2000
					});
				}
			}
		}
	}
</script>

<style lang="scss">
	.fv{
		float: left;
		border: 3upx solid #007AFF;
		padding: 10upx;
		margin-left: 30upx;
	}
.appoint-item {
	background-color: #fff;
	margin-bottom: 20upx;
	padding: 20upx;
	height: 200upx;
	padding-left: 40upx;
	position: relative;
	>view {
		margin-bottom: 20upx;
	}
	image {
		width: 40upx;
		height: 40upx;
		position: absolute;
		top: 20upx;
		right: 40upx;
		&.edit {
			right: 120upx;
		}
	}
}
</style>
